﻿namespace AddressBook.Web
{
	#region "Using Statements"
	using System;
	using System.Collections.Generic;
	using System.Configuration;
	using System.Data;
	using System.Data.SqlClient;
	using System.Linq;
	using System.Web;
	using System.Web.UI;
	using System.Web.UI.WebControls;

	using Business.Contact;
	
	#endregion

	public partial class MailingLabels : System.Web.UI.Page
  {
    protected void Page_Load(object sender, EventArgs e)
    {
			if (!this.IsPostBack)
			{
				this.BindEventList();
			}
    }

		private void BindEventList()
		{
			EventList events = EventList.GetEventList();
			this.MailingEventList.DataSource = events;
			this.MailingEventList.DataTextField = "Name";
			this.MailingEventList.DataValueField = "Id";
			this.MailingEventList.DataBind();
		}

		protected void ReportSelectionRunImageButton_Click(object sender, ImageClickEventArgs e)
		{
			this.DownloadDataLink.NavigateUrl += String.Format("?EventId={0}", this.MailingEventList.SelectedValue);
			this.MailingLabelsMultiView.SetActiveView(this.ReportView);

			switch (this.ColorList.SelectedValue)
			{
				case "Black":
					this.MailingLabelsList.ForeColor = System.Drawing.Color.Black;
					break;
				case "Green":
					this.MailingLabelsList.ForeColor = System.Drawing.Color.Green;
					break;
				case "Red":
					this.MailingLabelsList.ForeColor = System.Drawing.Color.Red;
					break;
			}
		}
  }
}
